package dominion.player;

import dominion.Dominion;
import dominion.kingdom.Thief;

public class TwoThiefPlayer extends TresureOnlyPlayer {

	boolean buy = false;
	int times = 0;

	public TwoThiefPlayer(Dominion dominion) {
		this("TwoThief", dominion);
	}

	public TwoThiefPlayer(String name, Dominion dominion) {
		super(name, dominion);
	}

	@Override
	public int buy(Dominion dominion, int value) {
		if (((times < 1 && 3 < value) || times < 2 && 3 < value && value < 6)
				&& dominion.buy(this, new Thief())) {
			value -= 4;
			times++;
		} else {
			value = super.buy(dominion, value);
		}
		return 0;
	}
}
